﻿<Window x:Class="EndGameDBTester.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ctrl ="clr-namespace:Board2D;assembly=Board2D"
        Title="Daphne EGTB Viewer" Height="768" Width="1024" MinWidth="800" MinHeight="600"
        Background="{DynamicResource WindowBackgroundBrush}"
        WindowStartupLocation="CenterScreen" Icon="/EndGameDBTester;component/dama_cerna_ico.ico"
            >
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="2*"  />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        
        <!-- Checkers Board -->
        <Border x:Name="uxBoardBorder" Grid.Row="0" Grid.Column="0" Margin="5,10,5,5" 
                BorderThickness="5" BorderBrush="Black" CornerRadius="4" Padding="10" >
            <Canvas x:Name="uxBoardCanvas">
                <ctrl:ProfessionalGameBoard x:Name="uxBoard2D" />
            </Canvas>
        </Border>

        <!-- Controls Panels -->
        <Grid Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="50" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            
            <!-- EGTB Info -->
            <Grid Grid.Row="0" Margin="5">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="30" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <TextBox x:Name="uxEGTBPath" Grid.Row="0"  Grid.Column="0" IsReadOnly="True" Margin="5" HorizontalAlignment="Stretch"  />
                <Button x:Name="btnFindFolder" Grid.Row="0"  Grid.Column="1" Margin="5" Content="&gt;&gt;" Width="25" Height="25" />
                
                <TextBlock x:Name="uxEGTBInfo" Grid.Row="1" Grid.ColumnSpan="2" Margin="5" />               
            </Grid>
            
            <!-- Buttons -->
            <Grid Grid.Row="1" Margin="5">               
                <ToggleButton Grid.Column="0" Margin="5" Content="Toggle Editor" x:Name="uxEditor" Width="160"/>
            </Grid>
            
            <!-- Editor Controls -->
            <GroupBox Header="Editor" Grid.Row="2" Margin="5">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="1*"/>
                        <ColumnDefinition Width="1*"/>
                    </Grid.ColumnDefinitions>
                    
                    <!-- Side to Move Change -->
                    <StackPanel Grid.Column="0" Orientation="Vertical" Margin="5">
                        <RadioButton x:Name="uxWhiteToMove" GroupName="STM" Content="White to move" Margin="5" />
                        <RadioButton x:Name="uxBlackToMove" GroupName="STM" Content="Black to move" Margin="5" />
                    </StackPanel>
                    
                    <Button x:Name="uxClearBoard"    Grid.Column="1" Content="Clear board" Height="30" 
                            VerticalAlignment="Top" Margin="5" />                    
                </Grid>                
            </GroupBox>  
            
            <!-- Game Navigation Buttons -->
            <GroupBox Grid.Row="3" Header="Game navigation" Margin="5">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                    <Button x:Name="uxStart" Width="30" Height="30" Margin="5" Content="|&lt;" />
                    <Button x:Name="uxBack" Width="30" Height="30" Margin="5" Content="&lt;&lt;" />
                    <Button x:Name="uxForward" Width="30" Height="30" Margin="5" Content="&gt;&gt;" />
                    <Button x:Name="uxFinish" Width="30" Height="30" Margin="5" Content="&gt;|" />
                </StackPanel>                
            </GroupBox>
            
            <!-- EGTB Move View -->
            <GroupBox Header="EGTB View" Margin="5" Grid.Row="4">
                <Grid Margin="5">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <StackPanel Orientation="Horizontal" Grid.Row="0" Margin="3">
                        <TextBlock FontWeight="Bold">Current position:</TextBlock>
                        <TextBlock x:Name="uxCurrentPosition" Margin="5,0,0,0"></TextBlock>
                    </StackPanel>
                    <DataGrid x:Name="uxMoveList" Grid.Row="1" Margin="0,5,0,0" BorderBrush="Black" BorderThickness="2"
                              AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" 
                              SelectionMode="Single" >
                        <DataGrid.Columns>
                            <DataGridTextColumn Header="Move" Binding="{Binding Path=MoveTitle}" Width="1*" />
                            <DataGridTextColumn Header="Result" Binding="{Binding Path=GameResult}" Width="1*" />
                            <DataGridTextColumn Header="DTM" Binding="{Binding Path=DTM}" Width="1*" />                            
                        </DataGrid.Columns>                       
                    </DataGrid>  
                </Grid>
            </GroupBox>                        
        </Grid>    
    </Grid>
</Window>
